package com.ywq.app.web.mvc.misc;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONObject;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.ywq.app.biz.AuxContentBiz;
import com.ywq.app.biz.MemberBiz;
import com.ywq.app.domain.ArtBack;
import com.ywq.app.domain.ArtPic;
import com.ywq.app.domain.ArtProcessLog;
import com.ywq.app.domain.ArtReminder;
import com.ywq.app.domain.ArtRoomPic;
import com.ywq.app.domain.Channel;
import com.ywq.app.domain.Content;
import com.ywq.app.domain.Member;
import com.ywq.app.domain.OnLineUserListener;
import com.ywq.common.exception.AppBusinessException;
import com.ywq.common.page.PageModel;
import com.ywq.common.util.Common;

@Controller
public class AuxContentMiscController {
	private final static Logger logger = LoggerFactory
			.getLogger(AuxContentMiscController.class);

	@Autowired
	private AuxContentBiz auxContentBiz;
	@Autowired
	private MemberBiz memberBiz;

	// 首页
	@RequestMapping(value = "/misc/index/indexMisc.htm")
	public String indexMisc(HttpServletRequest request,
			HttpServletResponse response) throws IOException {

		try {
			String identifier = auxContentBiz.getIdentifierByMark("indexMisc");
			request.setAttribute("parent", identifier);
		} catch (AppBusinessException e) {
			e.printStackTrace();
		}

		return "misc/index/indexMisc";
	}

	// 发现
	@RequestMapping(value = "/misc/index/foundMisc.htm")
	public String foundMisc(HttpServletRequest request,
			HttpServletResponse response) throws IOException {
		try {
			String identifier = auxContentBiz.getIdentifierByMark("foundMisc");
			request.setAttribute("parent", identifier);
		} catch (AppBusinessException e) {
			e.printStackTrace();
		}
		return "misc/index/foundMisc";
	}

	// 定制
	@RequestMapping(value = "/misc/index/madeContent.htm")
	public String madeContent(HttpServletRequest request,
			HttpServletResponse response) throws IOException {
		try {
			String identifier = auxContentBiz
					.getIdentifierByMark("madeContent");
			request.setAttribute("parent", identifier);
		} catch (AppBusinessException e) {
			e.printStackTrace();
		}
		return "misc/index/madeContent";
	}

	// 拍卖
	@RequestMapping(value = "/misc/index/auctionContent")
	public String auctionContent(HttpServletRequest request,
			HttpServletResponse response) throws IOException {

		try {
			String identifier = auxContentBiz
					.getIdentifierByMark("auctionContent");
			request.setAttribute("parent", identifier);
		} catch (AppBusinessException e) {
			e.printStackTrace();
		}

		return "misc/index/auctionContent";
	}

	// 展览馆
	@RequestMapping(value = "/misc/index/artRoomContent.htm")
	public String artRoomContent(HttpServletRequest request,
			HttpServletResponse response) throws IOException {

		try {
			String identifier = auxContentBiz
					.getIdentifierByMark("artRoomContent");
			request.setAttribute("parent", identifier);
		} catch (AppBusinessException e) {
			e.printStackTrace();
		}

		return "misc/index/artRoomContent";
	}

	// 活动
	@RequestMapping(value = "/misc/index/activityContent.htm")
	public String activityContent(HttpServletRequest request,
			HttpServletResponse response) throws IOException {

		try {
			String identifier = auxContentBiz
					.getIdentifierByMark("activityContent");
			request.setAttribute("parent", identifier);
		} catch (AppBusinessException e) {
			e.printStackTrace();
		}

		return "misc/index/activityContent";
	}

	// 关于我们
	@RequestMapping(value = "/misc/index/aboutUsContent.htm")
	public String aboutUsContent(HttpServletRequest request,
			HttpServletResponse response) throws IOException {

		try {
			String identifier = auxContentBiz
					.getIdentifierByMark("aboutUsContent");
			request.setAttribute("parent", identifier);
		} catch (AppBusinessException e) {
			e.printStackTrace();
		}

		return "misc/index/aboutUsContent";
	}

	/**
	 * 各频道列表
	 */
	@RequestMapping(value = "/misc/index/indexGrid.htm")
	public String indexGrid(Integer page, String parent,
			HttpServletRequest request, HttpServletResponse response)
			throws IOException {
		response.setContentType("text/html; charset=UTF-8");
		PrintWriter pw = null;
		try {
			if (page == null) {
				page = 1;
			}
			PageModel pageModelUser = auxContentBiz.getIndexListByChannel(page,
					parent);
			pw = response.getWriter();
			pw.print(JSONObject.fromObject(pageModelUser));
		} catch (Exception e) {
			pw = response.getWriter();
			pw.print("error");
			if (logger.isErrorEnabled()) {
				logger.error("getRoomIndexList failure.", e);
			}
		}
		return null;
	}

	/**
	 * 添加频道页面
	 * 
	 * @param mark
	 * @param request
	 * @param response
	 * @return
	 * @throws IOException
	 */
	@RequestMapping(value = "/misc/index/addChannel.htm")
	public String addChannel(String parent, HttpServletRequest request,
			HttpServletResponse response) throws IOException {

		request.setAttribute("parent", parent);
		return "misc/index/addChannel";
	}

	/**
	 * 增加频道
	 * 
	 * @param channel
	 * @param request
	 * @param response
	 * @param artPic
	 * @return
	 * @throws IOException
	 */
	@RequestMapping(value = "/misc/index/insertChannel.htm", method = RequestMethod.POST)
	public String insertChannel(Channel channel, HttpServletRequest request,
			HttpServletResponse response, ArtPic artPic) throws IOException {
		response.setContentType("text/html; charset=UTF-8");
		PrintWriter pw = null;
		try {
			auxContentBiz.insertChannel(channel);
			pw = response.getWriter();
			pw.print("success");
		} catch (Exception e) {
			pw = response.getWriter();
			pw.print("error");
			if (logger.isErrorEnabled()) {
				logger.error("insertChannel failure.", e);
			}
		}
		return null;
	}

	// 更新频道页面
	@RequestMapping(value = "/misc/index/updateChannelWeb.htm")
	public String getChannelById(String identifier,String type, HttpServletRequest request,
			HttpServletResponse response) throws IOException,
			AppBusinessException {
		Channel channel = auxContentBiz.getChannelById(identifier);
		request.setAttribute("parent", "parent");
		request.setAttribute("type", type);
		request.setAttribute("channel", channel);
		return "misc/index/addChannel";
	}

	// 更新频道
	@RequestMapping(value = "/misc/index/updateChannel.htm", method = RequestMethod.POST)
	public String updateChannel(Channel channel, HttpServletRequest request,
			HttpServletResponse response, ArtPic artPic) throws IOException {
		response.setContentType("text/html; charset=UTF-8");
		PrintWriter pw = null;
		try {
			auxContentBiz.updateChannel(channel);
			pw = response.getWriter();
			pw.print("success");
		} catch (Exception e) {
			pw = response.getWriter();
			pw.print("error");
			if (logger.isErrorEnabled()) {
				logger.error("updateChannel failure.", e);
			}
		}
		return null;
	}

	// 查看频道详情页面
	@RequestMapping(value = "/misc/index/showChannel.htm")
	public String showChannel(String channel,String type, HttpServletRequest request,
			HttpServletResponse response) throws IOException {
			request.setAttribute("channel", channel);
			request.setAttribute("type", type);
		return "misc/index/showChannel";
	}
	//频道列表查询
	@RequestMapping(value = "/misc/index/channelContentGrid.htm")
	public String channelContentGrid(Integer page, String channel,
			HttpServletRequest request, HttpServletResponse response)
			throws IOException {
		response.setContentType("text/html; charset=UTF-8");
		PrintWriter pw = null;
		try {
			if (page == null) {
				page = 1;
			}
			PageModel pageModelUser = auxContentBiz.getChannelContentListById(page,
					channel);
			pw = response.getWriter();
			pw.print(JSONObject.fromObject(pageModelUser));
		} catch (Exception e) {
			pw = response.getWriter();
			pw.print("error");
			if (logger.isErrorEnabled()) {
				logger.error("getRoomIndexList failure.", e);
			}
		}
		return null;
	}
	//添加内容页面
	@RequestMapping(value = "/misc/index/addContent.htm")
	public String addContent(String channel, String type,HttpServletRequest request,
			HttpServletResponse response) throws IOException {
			request.setAttribute("channel", channel);
			request.setAttribute("type", type);
		return "misc/index/addContent";
	}
	//添加内容页面
	@RequestMapping(value = "/misc/index/addRoomContent.htm")
	public String addRoomContent(String channel, HttpServletRequest request,
			HttpServletResponse response) throws IOException {
			request.setAttribute("channel", channel);
		return "misc/artRoom/addRoomConent";
	}
	//添加内容
	
	@RequestMapping(value = "/misc/index/insertAuxContent.htm", method = RequestMethod.POST)
	public String insertAuxContent(Content content, HttpServletRequest request,
			HttpServletResponse response, ArtPic artPic) throws IOException {
		response.setContentType("text/html; charset=UTF-8");
		PrintWriter pw = null;
		try {
			auxContentBiz.insertContent(content);
			pw = response.getWriter();
			pw.print("success");
		} catch (Exception e) {
			pw = response.getWriter();
			pw.print("error");
			if (logger.isErrorEnabled()) {
				logger.error("insertContent failure.", e);
			}
		}
		return null;
	}
	//删除频道
	@RequestMapping(value = "/misc/index/deleteChannel.htm", method = RequestMethod.POST)
	public String deleteChannel(String identifier, HttpServletRequest request,
			HttpServletResponse response, ArtPic artPic) throws IOException {
		response.setContentType("text/html; charset=UTF-8");
		PrintWriter pw = null;
		try {
			auxContentBiz.deleteChannel(identifier);
			pw = response.getWriter();
			pw.print("success");
		} catch (Exception e) {
			pw = response.getWriter();
			pw.print("error");
			if (logger.isErrorEnabled()) {
				logger.error("deleteChannel failure.", e);
			}
		}
		return null;
	}
	//删除频道
	@RequestMapping(value = "/misc/index/deleteContent.htm", method = RequestMethod.POST)
	public String deleteContent(String identifier, HttpServletRequest request,
			HttpServletResponse response, ArtPic artPic) throws IOException {
		response.setContentType("text/html; charset=UTF-8");
		PrintWriter pw = null;
		try {
			auxContentBiz.deleteContent(identifier);
			pw = response.getWriter();
			pw.print("success");
		} catch (Exception e) {
			pw = response.getWriter();
			pw.print("error");
			if (logger.isErrorEnabled()) {
				logger.error("deleteContent failure.", e);
			}
		}
		return null;
	}
	//更新内容页面
	@RequestMapping(value = "/misc/index/updateContent.htm")
	public String updateContent(String identifier, String type,HttpServletRequest request,
			HttpServletResponse response) throws IOException {
		try {
			Content content =auxContentBiz.getContentId(identifier);
			request.setAttribute("content", content);
			request.setAttribute("type", type);
			request.setAttribute("channel", content.getChannel());
		} catch (AppBusinessException e) {
			e.printStackTrace();
		}
		return "misc/index/updateContent";
	}
	//更新
	@RequestMapping(value = "/misc/index/updateAuxContent.htm", method = RequestMethod.POST)
	public String updateAuxContent(Content content, HttpServletRequest request,
			HttpServletResponse response, ArtPic artPic) throws IOException {
		response.setContentType("text/html; charset=UTF-8");
		PrintWriter pw = null;
		try {
			auxContentBiz.updateContent(content);
			pw = response.getWriter();
			pw.print("success");
		} catch (Exception e) {
			pw = response.getWriter();
			pw.print("error");
			if (logger.isErrorEnabled()) {
				logger.error("updateAuxContent failure.", e);
			}
		}
		return null;
	}
	@RequestMapping(value = "/misc/index/memberList.htm")
	public String memberList(String channel, String type,HttpServletRequest request,
			HttpServletResponse response) throws IOException {
		return "misc/admin/member";
	}
	
	//会员
	@RequestMapping(value = "/misc/admin/tomemberlist.htm")
	public String tomemberlistGird(Integer page,Integer pagesize,String name, HttpServletRequest request,
			HttpServletResponse response) throws IOException {
	

		response.setContentType("text/html; charset=UTF-8");
		PrintWriter pw = null;
		try {
			if (page == null) {
				page = 1;
			}
			PageModel pageModel = memberBiz.getMemberMode(page,pagesize,name);
			pw = response.getWriter();
			pw.print(JSONObject.fromObject(pageModel));
		} catch (Exception e) {
			pw = response.getWriter();
			pw.print("error");
			if (logger.isErrorEnabled()) {
				logger.error("Get role failure.", e);
			}
		}
		return null;
	}
	//订阅邮箱列表
	@RequestMapping(value = "/misc/reminder/reminderEmailAuction.htm")
	public String reminderEmailAuction(HttpServletRequest request, HttpServletResponse response) throws IOException {
		request.setAttribute("type", "auction");
		return "misc/reminder/reminderEmail";
	}
	
	@RequestMapping(value = "/misc/reminder/reminderEmailMade.htm")
	public String reminderEmailMade(HttpServletRequest request, HttpServletResponse response) throws IOException {
		request.setAttribute("type", "made");
		return "misc/reminder/reminderEmail";
	}
	@RequestMapping(value = "/misc/reminder/artEmailGrid.htm")
	public String artEmailGrid(Integer page,Integer pagesize, String type,HttpServletRequest request, HttpServletResponse response) throws IOException {
		response.setContentType("text/html; charset=UTF-8");
		PrintWriter pw = null;
		try {
			if (page == null) { 
				page = 1;
			}
			PageModel pageModel = auxContentBiz.getArtEmailGrid(page,pagesize,type);
			pw = response.getWriter();
			pw.print(JSONObject.fromObject(pageModel));
		} catch (Exception e) {
			pw = response.getWriter();
			pw.print("error");
			if (logger.isErrorEnabled()) {
				logger.error("Get role failure.", e);
			}
		}
		return null;
	}
	
	
	
	//邮件发送
	@RequestMapping(value = "/misc/reminder/reminder.htm")
	public String reminder (String type,HttpServletRequest request,
			HttpServletResponse response) throws IOException {
		request.setAttribute("type", type);
		return "misc/reminder/reminder";
	}
	
	//发送邮件
	
	@RequestMapping(value = "/misc/reminder/sendEmail.htm", method = RequestMethod.POST)
	public String sendEmail(String description, String type, HttpServletRequest request,
			HttpServletResponse response, ArtPic artPic) throws IOException {
		response.setContentType("text/html; charset=UTF-8");
		PrintWriter pw = null;
		try {
			Map<String, Object> map = new HashMap<String, Object>();
			map.put("description", description);
			map.put("type", type);
			auxContentBiz.sendEmail(map);
			pw = response.getWriter();
			pw.print("success");
		} catch (Exception e) {
			pw = response.getWriter();
			pw.print("error");
			if (logger.isErrorEnabled()) {
				logger.error("updateAuxContent failure.", e);
			}
		}
		return null;
	}
	//发送 不发送
	
	@RequestMapping(value = "/misc/artMade/updateEamil.htm", method = RequestMethod.POST)
	public String updateEamil(ArtReminder artReminder, HttpServletRequest request, HttpServletResponse response, ArtPic artPic) throws IOException {
		response.setContentType("text/html; charset=UTF-8");
		PrintWriter pw = null;
		try {
			auxContentBiz.updateArtReminder(artReminder);
			pw = response.getWriter();
			pw.print("success");
		} catch (Exception e) {
			pw = response.getWriter();
			pw.print("error");
			if (logger.isErrorEnabled()) {
				logger.error("updateAuxContent failure.", e);
			}
		}
		return null;
	}
	//订单
	@RequestMapping(value = "/misc/member/memberOrderList.htm")
	public String memberOrderList(HttpServletRequest request, HttpServletResponse response) throws IOException {
		return "misc/reminder/memberOrderList";
	}
	@RequestMapping(value = "/misc/member/memberOrderListGrid.htm")
	public String memberOrderListGrid(Integer page,Integer pagesize, String type,HttpServletRequest request, HttpServletResponse response) throws IOException {
		response.setContentType("text/html; charset=UTF-8");
		PrintWriter pw = null;
		try {
			if (page == null) { 
				page = 1;
			}
			PageModel pageModel = memberBiz.getOrdersById(page,null,null);
			pw = response.getWriter();
			pw.print(JSONObject.fromObject(pageModel));
		} catch (Exception e) {
			pw = response.getWriter();
			pw.print("error");
			if (logger.isErrorEnabled()) {
				logger.error("Get role failure.", e);
			}
		}
		return null;
	}
	
	
	//保证金
	
	@RequestMapping(value = "/misc/member/memberSecurity.htm")
	public String memberSecurity(HttpServletRequest request, HttpServletResponse response) throws IOException {
		return "misc/reminder/memberSecurity";
	}
	
	@RequestMapping(value = "/misc/member/memberSecurityGrid.htm")
	public String memberSecurityGrid(Integer page,Integer pagesize, String type,HttpServletRequest request, HttpServletResponse response) throws IOException {
		response.setContentType("text/html; charset=UTF-8");
		PrintWriter pw = null;
		try {
			if (page == null) { 
				page = 1;
			}
			PageModel pageModel = memberBiz.getMemberSecurity(page,pagesize);
			pw = response.getWriter();
			pw.print(JSONObject.fromObject(pageModel));
		} catch (Exception e) {
			pw = response.getWriter();
			pw.print("error");
			if (logger.isErrorEnabled()) {
				logger.error("Get role failure.", e);
			}
		}
		return null;
	}
	//重置保证金页面
	@RequestMapping(value = "/misc/member/resetAccount.htm")
	public String resetAccount(String memberId,HttpServletRequest request, HttpServletResponse response) throws IOException {
		try {
			Member member = memberBiz.getMemberById(memberId);
			request.setAttribute("member", member);
		} catch (AppBusinessException e) {
			e.printStackTrace();
		}
		return "misc/reminder/resetAccount";
	}
	//
	@RequestMapping(value = "/misc/reminder/updateResetAccount.htm", method = RequestMethod.POST)
	public String updateResetAccount(String id,float artAccount, HttpServletRequest request, HttpServletResponse response, ArtPic artPic) throws IOException {
		response.setContentType("text/html; charset=UTF-8");
		PrintWriter pw = null;
		try {
			
			memberBiz.updateResetAccount(id,artAccount);
			pw = response.getWriter();
			pw.print("success");
		} catch (Exception e) {
			pw = response.getWriter();
			pw.print("error");
			if (logger.isErrorEnabled()) {
				logger.error("updateAuxContent failure.", e);
			}
		}
		return null;
	}
	//更新会员为作废
	@RequestMapping(value = "/misc/admin/deleteNickName.htm", method = RequestMethod.POST)
	public String deleteNickName(String id, HttpServletRequest request, HttpServletResponse response) throws IOException {
		response.setContentType("text/html; charset=UTF-8");
		PrintWriter pw = null;
		try {
			memberBiz.updateMemberEnabled(id);
			//auxContentBiz.updateArtReminder(artReminder);
			pw = response.getWriter();
			pw.print("success");
		} catch (Exception e) {
			pw = response.getWriter();
			pw.print("error");
			if (logger.isErrorEnabled()) {
				logger.error("updateAuxContent failure.", e);
			}
		}
		return null;
	}
	//退货
	@RequestMapping(value = "/misc/member/memberBackList.htm")
	public String memberBackList(HttpServletRequest request, HttpServletResponse response) throws IOException {
		return "misc/reminder/memberBackList";
	}
	//退货列表
	@RequestMapping(value = "/misc/member/memberBackListGrid.htm")
	public String memberBackListGrid(Integer page,Integer pagesize,HttpServletRequest request, HttpServletResponse response) throws IOException {
		response.setContentType("text/html; charset=UTF-8");
		PrintWriter pw = null;
		try {
			if (page == null) { 
				page = 1;
			}
			PageModel pageModel = memberBiz.memberBackListGrid(page,pagesize);
			pw = response.getWriter();
			pw.print(JSONObject.fromObject(pageModel));
		} catch (Exception e) {
			pw = response.getWriter();
			pw.print("error");
			if (logger.isErrorEnabled()) {
				logger.error("Get role failure.", e);
			}
		}
		return null;
	}
	//退货拒绝
	@RequestMapping(value = "/misc/member/refusalBack.htm", method = RequestMethod.POST)
	public String refusalBack(String oId, String content,HttpServletRequest request, HttpServletResponse response) throws IOException {
		response.setContentType("text/html; charset=UTF-8");
		PrintWriter pw = null;
		try {
			memberBiz.updateBackOrders(oId,"refusal",content);
			pw = response.getWriter();
			pw.print("success");
		} catch (Exception e) {
			pw = response.getWriter();
			pw.print("error");
			if (logger.isErrorEnabled()) {
				logger.error("updateAuxContent failure.", e);
			}
		}
		return null;
	}
	//退货同意
	@RequestMapping(value = "/misc/member/agreeBack.htm", method = RequestMethod.POST)
	public String agreeBack(String oId,String content, HttpServletRequest request, HttpServletResponse response) throws IOException {
		response.setContentType("text/html; charset=UTF-8");
		PrintWriter pw = null;
		try {
			memberBiz.updateBackOrders(oId,"agree",content);
			pw = response.getWriter();
			pw.print("success");
		} catch (Exception e) {
			pw = response.getWriter();
			pw.print("error");
			if (logger.isErrorEnabled()) {
				logger.error("updateAuxContent failure.", e);
			}
		}
		return null;
	}
	//更新到货 审核 状态 同意
    @RequestMapping(value = "/misc/member/agreeReceiptBack.htm")
	public void  agreeReceiptBack(String backId,HttpServletRequest request,HttpServletResponse response) throws AppBusinessException {
		try {
					ArtBack artBack =new ArtBack();
					artBack.setBackId(backId);
					artBack.setStatus("03");//同意
					ArtProcessLog artProcessLog =new ArtProcessLog();
					artProcessLog.setStatus(Common.BACK_TO_INFO_AGREE);//同意
					artProcessLog.setContent("已同意");
					memberBiz.updateArtBack(artBack,artProcessLog);
					//同时变更原始订单04未退款
					Map<String, Object> map = new HashMap<String, Object>();
					map.put("backStatus", "04");
					map.put("id", backId);
					memberBiz.updateOrders(map);
					response.setContentType("text/html; charset=UTF-8");
					PrintWriter pw = null;
					pw = response.getWriter();
					pw = response.getWriter();
					pw.print("success");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
    //更新到货 审核 状态 拒绝
    @RequestMapping(value = "/misc/member/refusalReceiptBack.htm")
	public void  refusalReceiptBack(String backId,String path,String content,HttpServletRequest request,HttpServletResponse response) throws AppBusinessException {
		try {
			
					ArtBack artBack =new ArtBack();
					artBack.setBackId(backId);
					artBack.setStatus("02");//同意
					ArtProcessLog artProcessLog =new ArtProcessLog();
					artProcessLog.setPath(path);
					artProcessLog.setStatus(Common.BACK_TO_INFO_REFUSAL);//同意
					artProcessLog.setContent(content);
					memberBiz.updateArtBack(artBack,artProcessLog);
					//同时变更原始订单状态 02
					Map<String, Object> map = new HashMap<String, Object>();
					map.put("backStatus", "02");
					map.put("id", backId);
					memberBiz.updateOrders(map);
					response.setContentType("text/html; charset=UTF-8");
					PrintWriter pw = null;
					pw = response.getWriter();
					pw = response.getWriter();
					pw.print("success");
				
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
    //查看物流
    @RequestMapping(value = "/misc/index/showExpressBack.htm")
	public String showRoomDetail(String oid, HttpServletRequest request,
			HttpServletResponse response) throws IOException {
			try {
				ArtBack artBack =memberBiz.getArtBackByOid(oid);
				request.setAttribute("artBack", artBack);
			} catch (AppBusinessException e) {
				e.printStackTrace();
			}
		return "misc/reminder/showBackDetail";
	}
    @RequestMapping(value = "/misc/member/payBack.htm", method = RequestMethod.POST)
	public String payBack(String oId, HttpServletRequest request, HttpServletResponse response) throws IOException {
		response.setContentType("text/html; charset=UTF-8");
		PrintWriter pw = null;
		try {
			memberBiz.updateBackOrders(oId,"pay","");
			pw = response.getWriter();
			pw.print("success");
		} catch (Exception e) {
			pw = response.getWriter();
			pw.print("error");
			if (logger.isErrorEnabled()) {
				logger.error("updateAuxContent failure.", e);
			}
		}
		return null;
	}
    
}
